home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
cdsioreg.h.z
/
cdsioreg.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
9KB
|
229 lines
/*
* Definitions for the Central Data 3608 8 port serial i/o interface
*
* Copyright 1989 Silicon Graphics, Inc. All rights reserved.
*
* $Revision: 3.12 $
*/
#ifdef _KERNEL
#define OUTBUF_LEN 3056
#define INBUF_LEN 1024 /* assumed to be a power of 2 */
/*
* Layout of the dual port ram
*/
struct device {
unchar outputBuf0[OUTBUF_LEN]; /* 0000-0BEF: output buffer 0 */
unchar outputBuf1[OUTBUF_LEN]; /* 0BF0-17DF: output buffer 1 */
unchar inputBuf[INBUF_LEN]; /* 17E0-1BDF: input buffer */
unchar errorBuf[INBUF_LEN]; /* 1BE0-1FDF: error buffer */
unchar pad0; /* 1FE0: not used */
unchar cmd; /* 1FE1: command code */
unchar cmdHigh; /* 1FE2: command data, high byte */
unchar cmdLow; /* 1FE3: command data, low byte */
unchar pad1; /* 1FE4: not used */
unchar cmdStatus; /* 1FE5: command status */
unchar pad2; /* 1FE6: not used */
unchar uartStatus; /* 1FE7: status from uart */
ushort inputFillPtr; /* 1FE8-1FE9: input filling pointer */
ushort inputEmptyPtr; /* 1FEA-1FEB: input emptying ptr */
ushort inputOverflows; /* 1FEC-1FED: input buf overflows */
unchar pad3; /* 1FEE: not used */
unchar intSourceFlag; /* 1FEF: interrupt source flag */
unchar pad4; /* 1FF0: not used */
unchar outputBusy; /* 1FF1: output busy flag */
unchar pad5; /* 1FF2: not used */
unchar outputStopped; /* 1FF3: output stopped */
unchar pad6; /* 1FF4: not used */
unchar parityError; /* 1FF5: parity error */
unchar pad7; /* 1FF6: not used */
unchar portIntStatusFlag; /* 1FF7: port interrupt status flag */
unchar pad8[6]; /* 1FF8-1FFD: not used */
ushort firmwareRev; /* 1FFE-1FFF: firmware revision */
};
/*
* On the CD3608 board the command port and hostStatusPort overlay the
* memory space for port 7.
*/
struct iodevice {
char padports[8192*7]; /* ports 0-6 */
char pad[0x1FFC]; /* E000-FFFB: buffer for port 7 */
unchar pad0; /* FFFC: not used */
unchar hostStatusPort; /* FFFD: status port */
unchar pad1; /* FFFE: not used */
unchar cmdPort; /* FFFF: command port */
};
/* bits in the uartStatus.
* The boards do not like to talk when DCD is low, so we use DSR
* instead. Another problem is that we have shipped some large number
* of IP4/3608 systems with cables which do not shuffle the wires.
*/
#define DCD_BIT (cdnewcable ? SCC_DSR : SCC_DCD)
/* bits in the errorBuf */
#define ERRB_FRAMING 0x40 /* framing error */
#define ERRB_OVERRUN 0x20 /* overrun error */
#define ERRB_PARITY 0x10 /* parity error */
#define ERRB_BREAK 0x01 /* BREAK input */
/* bits in the uartStatus */
#define SCC_DCD 0x04 /* DCD active */
#define SCC_DSR 0x08 /* DSR active */
/* bits in intSourceFlag */
#define ISF_PARITY 0x08 /* parity error interrupt */
#define ISF_STATUS 0x04 /* status change interrupt */
#define ISF_INPUT 0x02 /* input interrupt */
#define ISF_OUTPUT 0x01 /* output done interrupt */
/* bits in hostStatusPort */
#define HSP_INT 0x08 /* this board interrupted */
#define HSP_READY 0x01 /* board is ready for a command */
/* cmd's */
#define CMD_SET_SCC 0x00 /* set scc register */
#define CMD_SET_BAUD 0x01 /* set baud rate registers */
#define CMD_SET_XONMASK 0x02 /* set xon/xoff mask/enables */
#define CMD_SET_XONCHAR 0x03 /* set xon/xoff characters */
#define CMD_SEND_0 0x04 /* send block 0 */
#define CMD_SEND_1 0x05 /* send block 1 */
#define CMD_SEND_NOW 0x06 /* send immediate character */
#define CMD_SEND_BREAK 0x07 /* send break */
#define CMD_SET_IDT 0x08 /* set input delay time */
#define CMD_SET_HWM 0x09 /* set high water mark */
#define CMD_SET_III 0x0A /* set immediate input interrupt */
#define CMD_SET_ISB0 0x0B /* set interrupt on status bits 0 */
#define CMD_SET_ISB1 0x0C /* set interrupt on status bits 1 */
#define CMD_SET_INPUT 0x0D /* set input interrupt */
#define CMD_SET_OUTPUT 0x0E /* set output interrupt */
#define CMD_SET_STATUS 0x0F /* set status interrupt */
#define CMD_SET_PARITY 0x10 /* set parity interrupt */
#define CMD_NUM (CMD_SET_PARITY+1)
/* high bits in ipl for CMD_SET_{INPUT/OUTPUT/STATUS/PARITY} */
#define INT_ENABLE 0x08 /* enable interrupts */
#define INT_ROAK 0x80 /* reset on ack */
/*
* CD3608 uart registers
*/
/* bits in SCC write register 3 (used by CMD_SET_SCC) */
#define WR3_BPC_5 0x00 /* 5 bits per character */
#define WR3_BPC_7 0x40 /* 7 bits per character */
#define WR3_BPC_6 0x80 /* 6 bits per character */
#define WR3_BPC_8 0xC0 /* 8 bits per character */
#define WR3_DCD 0x20 /* DCD & CTS control enable */
#define WR3_RCV 0x01 /* receiver enabled */
/* bits in SCC write register 4 (used by CMD_SET_SCC) */
#define WR4_CLK_1 0x00 /* clock rate x1 */
#define WR4_CLK_16 0x40 /* clock rate x16 */
#define WR4_CLK_32 0x80 /* clock rate x32 */
#define WR4_CLK_64 0xC0 /* clock rate x64 */
#define WR4_STOP_NONE 0x00 /* 0 stop bits */
#define WR4_STOP_1 0x04 /* 1 stop bits */
#define WR4_STOP_15 0x08 /* 1.5 stop bits */
#define WR4_STOP_2 0x0C /* 2 stop bits */
#define WR4_EVEN 0x02 /* even parity */
#define WR4_PARITY 0x01 /* enable parity */
/* bits in SCC write register 5 (used by CMD_SET_SCC) */
#define WR5_DTR 0x80 /* DTR active */
#define WR5_BPC_5 0x00 /* 5 bits per character */
#define WR5_BPC_7 0x20 /* 7 bits per character */
#define WR5_BPC_6 0x40 /* 6 bits per character */
#define WR5_BPC_8 0x60 /* 8 bits per character */
#define WR5_BIT3 0x08 /* bit 3 (must be one) */
#define WR5_RTS 0x02 /* RTS enable */
/* bits in SCC write register 14 (used by CMD_SET_SCC) */
#define WR14_LOOP 0x10 /* enable local loopback */
#define WR14_ECHO 0x08 /* auto echo enable */
#define WR14_DTRCTL 0x04 /* dtr control */
#define WR14_CONST 0x03 /* must be ones */
#endif /* _KERNEL */
/*
* This structure is used to manage the software state of each
* serial port.
*/
typedef struct cdport {
ushort cd_framingErrors; /* # of framing errors */
ushort cd_overruns; /* # of overrun errors */
ushort cd_overflows; /* # of overflows */
ushort cd_allocb_fail; /* losses due to allocb() failures */
volatile struct device *cd_device; /* port device address */
volatile struct iodevice *cd_iodevice; /* pointer to i/o port */
struct termio cd_termio;
#define cd_iflag cd_termio.c_iflag
#define cd_cflag cd_termio.c_cflag
#define cd_lflag cd_termio.c_lflag
#define cd_line cd_termio.c_line /* 'line discipline' */
#define cd_cc cd_termio.c_cc
ushort cd_oldcflag; /* previous mode bits */
unchar cd_mask0, cd_mask1;
unchar cd_rts_dtr;
unchar cd_bit; /* 1 << board port number */
int cd_minor; /* minor device number */
int cd_xmitlimit; /* output burst size */
int cd_xmit; /* bytes waiting to be sent */
ulong cd_late_lbolt; /* it started being late then */
ulong cd_state; /* current state */
queue_t *cd_rq, *cd_wq; /* our queues */
mblk_t *cd_rmsg, *cd_rmsge; /* current input message */
int cd_rmsg_len;
int cd_rbsize; /* recent message length */
mblk_t *cd_rbp; /* current input buffer */
int cd_tid; /* (recent) output delay timer ID */
} CDPORT;
/* bits in cd_state */
#define CD_ISOPEN 0x1 /* device is open */
#define CD_WOPEN 0x2 /* waiting for carrier */
#define CD_DCD 0x4 /* we have carrier */
#define CD_TIMEOUT 0x8 /* delaying */
#define CD_BREAK 0x10 /* breaking */
#define CD_TIMERS (CD_TIMEOUT|CD_BREAK)
#define CD_LATER 0x20 /* retry-timer active */
#define CD_RETRY_ACK 0x40 /* delayed interrupt ACK */
#define CD_RETRY 0x80 /* waiting for the device */
#define CD_NEW_RETRY 0x100 /* recently started waiting */
#define CD_OUTBUSY 0x200 /* expecting output interrupt */
#define CD_BUSY (CD_TIMERS|CD_OUTBUSY)
#define CD_TXSTOP 0x400 /* output stopped by received XOFF */
#define CD_LIT 0x800 /* have seen literal character */
#define CD_BLOCK 0x1000 /* XOFF sent because input full */
#define CD_TX_TXON 0x2000 /* need to send XON */
#define CD_TX_TXOFF 0x4000 /* need to send XOFF */
#define CD_RTS 0x8000 /* set RTS=1 */
#define CD_FLOW 0x10000 /* do hardware flow control */
#define CD_OFF_INT 0x20000 /* expect DCD-off interrupt */
#define CD_ON_INT 0x40000 /* expect DCD-on interrupt */
#define CD_MODEM 0x80000 /* modem device */
#define CD_REPRO_MASK 0xf00000 /* steps in reprograming */
#define CD_REPRO_INC 0x100000
#define CD_REPRO_STEP(cdp) ((cdp)->cd_state & CD_REPRO_MASK)
#define CD_REPRO_ADV(cdp) ((cdp)->cd_state += CD_REPRO_INC)
#define CD_REPRO(n) ((n)*CD_REPRO_INC)
#define CDUPC_LN 3
#define CDUPC (1<<CDUPC_LN) /* 8 units per controller */